<?php
namespace app\home\controller;
use think\Controller;
use think\Validate;
class Newshow extends Base
{
	//宝典
	public function news()
	{
		$id='';
		if(input('id1')!=null)
		{
			$res=model('newsClassify')->sel1(input('id1'));
			foreach($res as $v)
			{
				$id.=$v['id'].',';
			}
			$id=substr($id,0,-1);
		}
		if(input('id2')!=null)
		{
			$id=input('id2');
		}
		//var_dump($id);
		$a=model('newsContent');
		$con=$a->selmy($id)->paginate([
			'list_rows'=>4,
			'query'=>input('get.'),
			'var_page'=>'p'
		]);;
		//dump($con);
		$this->assign('con',$con);
		$a='';
		foreach($con as $v)
		{
			$a=$v['allimg'];
		}
		$a=explode(',',$a);
		$a=$a[0];
		//dump($a);
		$this->assign('a',$a);


		$le1=model('newsClassify')->sellev1();
		$le2=model('newsClassify')->sellev2();
		$this->assign('le1',$le1);
		$this->assign('le2',$le2);
		return $this->fetch();
	}

	//宝典详情
	public function newsinfo()
	{
		//dump(input('pid'));
		//dump(input('id'));
		$topname=model('newsClassify')->selid(input('pid'));
		$all=model('newsContent')->selone(input('id'));
		$this->assign('topname',$topname);
		$this->assign('all',$all);
		$img='';
		$img=explode(',',$all[0]['allimg']);
		//dump($a);
		$this->assign('img',$img);
		return $this->fetch();
	}
}